﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Alos.Entity;
using Alos.IRepository;
using PetaPoco;

namespace Alos.Repository
{
    public class ReSubmitRecordRepository : BaseRepository<ReSubmitRecord>, IReSubmitRecordRepository
    {
        /// <summary>
        /// 学生提交记录
        /// </summary>
        /// <param name="id"></param>
        /// <param name="roleid"></param>
        /// <returns></returns>
        public int CreateReSubmitRecord(ReSubmitRecord ReSubmitRecord)
        {
            return Convert.ToInt32(ReSubmitRecord.Insert());            
        }
        /// <summary>
        /// 修改学生提交记录
        /// </summary>
        /// <param name="ArrangeID">发布记录ID</param>   
        ///  <param name="StudentID">学生ID</param>    
        /// <returns></returns>
        public bool UpdateSubmitRecord(string ArrangeID, int ResourceID, int StudentID)
        {
            var sql = Sql.Builder.Append(@"UPDATE [dbo].[ReSubmitRecord] SET [IsSubmit]=1 WHERE ArrangeID=@0 and ResourceID=@1 and StudentID=@2", ArrangeID,ResourceID, StudentID);
            return DBContext.Execute(sql)>0;
        }
    }
}
